package org.simpla.ufaerdigt;

import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.database.Cursor;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import java.util.Set;
import org.simpla.R;
import org.simpla.SimplaActivity;

/**
 * 
 * @author Jacob Nordfalk
 */
public class Eks9_bluetooth {
  Cursor c;
/*
extends SimplaActivity
 *
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
  }

  @Override
  public void simplaMain() throws Exception {
		TextView tv = new TextView(this);
		tv.setText("Smpel Bluetooth\n");
    tv.setTextSize(18);
		simpla.setContentView(tv);

    // Get the local Bluetooth adapter
    BluetoothAdapter mBtAdapter=BluetoothAdapter.getDefaultAdapter();

    // Get a set of currently paired devices
    Set<BluetoothDevice> pairedDevices = mBtAdapter.getBondedDevices();

    simpla.println(tv, "Der blev fundet "+pairedDevices.size()+" enheder:");
    for (BluetoothDevice device : pairedDevices) {
      simpla.println(tv, device.getName() + "\n" + device.getAddress());
    }


    if (pairedDevices.size()==0 ||
        "Ja".equals(simpla.showTwoButtonAlertDialog("Scan efter flere enheder?", "Ja", "Nej")))
    {
        // If we're already discovering, stop it
        if (mBtAdapter.isDiscovering()) {
            mBtAdapter.cancelDiscovery();
        }

        final ArrayList<String> newDevices = new ArrayList<String>();

    // The BroadcastReceiver that listens for discovered devices and
    // changes the title when discovery is finished
    BroadcastReceiver mReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();

            // When discovery finds a device
            if (BluetoothDevice.ACTION_FOUND.equals(action)) {
                // Get the BluetoothDevice object from the Intent
                BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
                // If it's already paired, skip it, because it's been listed already
                if (device.getBondState() != BluetoothDevice.BOND_BONDED) {
                    mNewDevicesArrayAdapter.add(device.getName() + "\n" + device.getAddress());
                }
            // When discovery is finished, change the Activity title
            } else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
                setProgressBarIndeterminateVisibility(false);
                setTitle(R.string.select_device);
                if (mNewDevicesArrayAdapter.getCount() == 0) {
                    String noDevices = getResources().getText(R.string.none_found).toString();
                    mNewDevicesArrayAdapter.add(noDevices);
                }
            }
        }
    };

        // Register for broadcasts when a device is discovered
        IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
        this.registerReceiver(mReceiver, filter);

        // Register for broadcasts when discovery has finished
        filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
        this.registerReceiver(mReceiver, filter);

        // Request discover from BluetoothAdapter
        mBtAdapter.startDiscovery();

    }




  }
*/
}
